﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Model
{
    public delegate void UpdateData();
    [Serializable]
    public class TodoItem
    {
        private int id;
        /// <summary>
        /// 标题
        /// </summary>
        private string headline;
        /// <summary>
        /// 未/ 完成
        /// </summary>
        private bool finished;

      
        public UpdateData update;

        public TodoItem() { }
        public TodoItem(string headline,bool complete)
        {
            this.Headline = headline;
            this.Finished = complete;
        }

        public bool Finished
        {
            get
            {
                return finished;
            }

            set
            {
                
                finished = value;
                if (update!=null)
                {
                    update();
                }
               
            }
        }

        public int Id
        {
            get
            {
                return id;
            }

            set
            {
                id = value;
                if (update != null)
                {
                    update();
                }
            }
        }

        public string Headline
        {
            get
            {
                return headline;
            }

            set
            {
                headline = value;
                if (update != null)
                {
                    update();
                }
            }
        }
    }
}
    

